﻿$(function() {tip
    $(window.parent.document).find("#contentTitle").text("期间缴费");
    $("#SaveCondition").button();
    $("#UploadFile").button();
    $.fx.speeds._default = 1000;
    $( "#dialog" ).dialog({
        autoOpen: false,
        closeOnEscape: false,
        bgiframe: true,
        modal: true,
        draggable: false,
        resizable: false,
        open: function(event,ui){ $(".ui-dialog-titlebar-close").hide(); }
    });
    $("#UploadFile").click(function(){
	    var fso=new ActiveXObject("Scripting.FileSystemObject");
	    var opath=fso.GetFile($("#ServiceIdImport").val());
	    //For Test The File MaxSize
	    if(opath.size > (300*1024))
	    {
	        alert("上传文件超过300K请分批查询！");
	        return false;
	    }
	    else
	    {
	        $("#tip").text("正在上传文件...");
	        $( "#dialog" ).dialog( "open" );
	        return true;
	    }
	});
    $( "#SaveCondition" ).click(function() {    
        if($("#UploadFile").val() == "已上传")
        {
            $( "#dialog" ).dialog( "open" );
            return true;
        }	
        var mime = $("#ServiceIdImport").val().substr($("#ServiceIdImport").val().lastIndexOf('.')+1);        
        if(mime.length == 0)
        {
            alert("请上传含有服务号码的文本文件!");
        }
        else if(mime.toLowerCase() != "txt")
        {
            alert("只能上传TXT格式文件!");
        }
        else
        {
            alert("请点击上传按钮上传所选文件！");
            $("#UploadFile").focus();
        }	
        return false;
    });
    $( "#txtDiv" ).dialog({
        autoOpen: false,
        bgiframe: true,
        width:800,
        height:480
    });
    $("#openView").click(function(){
        $('#txtDiv').dialog( 'open' );
        return false;
    });
    $("#ViewFrame").attr("src","TxtExample.html");
});

